package com.copa.l215;

import java.util.Arrays;

/**
 * @author copa
 * @createDate 2022-05-29 11:19
 * @function 暴力法
 */
public class Test1 {

    public int findKthLargest(int[] nums, int k) {
        if (k > nums.length) {
            return -1;
        }
        Arrays.sort(nums);
        return nums[nums.length - k];
    }

    public static void main(String[] args) {
        int[] nums = {3,2,1,5,6,4};
        System.out.println(new Test1().findKthLargest(nums, 2));
    }
}
